package innerclass;
//再访工厂
import static net.mindview.util.Print.*;
public interface Service {
    void method1();
    void method2();
}
interface ServiceFactory{
    Service getService();
}
class Implementation1 implements Service{
    private Implementation1(){}
    @Override
    public void method1() {
        print("Implementation1 method1");
    }

    @Override
    public void method2() {
        print("Implementation1 method2");
    }

    public static ServiceFactory factory= new ServiceFactory() {
        @Override
        public Service getService() {
            return new Implementation1();
        }
    };
}


class Implementation2 implements Service{
private Implementation2(){

}
    @Override
    public void method1() {
            print("Implementation2 method1");
    }

    @Override
    public void method2() {
        print("Implementation2 method2");
    }

    public static ServiceFactory serviceFactory=new ServiceFactory() {
        @Override
        public Service getService() {
            return new Implementation2();
        }
    };


}


